package org.nimi317.web_gis.utils;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @author thunderobot
 */
public class DoubleUtils {

    public static String roundAndRemoveTrailingZeros(double value, int scale) {
        BigDecimal bd = BigDecimal.valueOf(value);
        bd = bd.setScale(scale, RoundingMode.HALF_UP);
        return bd.stripTrailingZeros().toPlainString();
    }
}
